package hu.lacimol.tutorial.todo.action;

import hu.lacimol.tutorial.todo.service.TodoService;


public class EditTodoAction extends TodoAction {

	private static final long serialVersionUID = -2345865120367035004L;

	public EditTodoAction(TodoService todoService) {
		super(todoService);
	}

	@Override
	protected String doExecute() throws Exception {
		final String description = request.getParameter("description");
		todo.setDescription(description);
		todo.save();

		return getRedirect(VIEW_PAGE);
	}

	public String doEdit() throws Exception {
		doKeyValidation();
		return INPUT;
	}

	@Override
	public void doValidation() {
		doKeyValidation();
		doFieldValidation();
	}

}